home *** CD-ROM | disk | FTP | other *** search
- on optimizeHardWireCastNum
- repeat with x = 1 to 1000
- if the castType of cast x = #script then
- set castScriptText to the scriptText of cast x
- set prevCastScriptText to EMPTY
- repeat while offset("the number of cast", castScriptText)
- set startOffset to offset("the number of cast", castScriptText)
- set firstQuoteFlag to 0
- set endOffset to startOffset + 18
- if (char endOffset of castScriptText = QUOTE) or (char endOffset + 1 of castScriptText = QUOTE) then
- repeat while (char endOffset of castScriptText <> QUOTE) or not firstQuoteFlag
- if char endOffset of castScriptText = RETURN then
- exit repeat
- end if
- if char endOffset of castScriptText = QUOTE then
- set firstQuoteFlag to 1
- end if
- set endOffset to endOffset + 1
- end repeat
- if char endOffset of castScriptText = RETURN then
- debug("ERROR: " & char startOffset to endOffset of castScriptText & ": Encountered RETURN b4 close quote")
- debug("NOT REPLACED!!")
- set prevCastScriptText to prevCastScriptText & char 1 to endOffset of castScriptText
- delete char 1 to endOffset of castScriptText
- else
- set castNumber to 0
- do("set castNumber = " & char startOffset to endOffset of castScriptText)
- debug("Replacing " & char startOffset to endOffset of castScriptText & " with " & castNumber)
- put castNumber into char startOffset to endOffset of castScriptText
- end if
- next repeat
- end if
- debug("ERROR: " & char startOffset to endOffset + 1 of castScriptText & ": No legal opening quote encountered")
- debug("NOT REPLACED!!")
- set prevCastScriptText to prevCastScriptText & char 1 to endOffset of castScriptText
- delete char 1 to endOffset of castScriptText
- end repeat
- set the scriptText of cast x to prevCastScriptText & castScriptText
- end if
- end repeat
- end
-